/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.GUI.moves;

import ac.GUI.index;
import ac.settings.dataModel;
import ac.settings.files;
import static ac.settings.rowsStatus.rowDeleted;
import ac.settings.sqlQuerys;
import ac.ui.controls.PCLPanel;
import ac.ui.custemItmes;
import ac.ui.utils;
import ac.uitls.propertiesOperation;
import java.awt.Component;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 *
 * @author escapes
 */
public class pricView extends PCLPanel implements dataModel, files, sqlQuerys {

    /**
     * Creates new form sell
     */
    ac.engin.archive.Products p = new ac.engin.archive.Products();

    propertiesOperation po = new propertiesOperation();
    ac.engin.moves.inventoryOutput i = new ac.engin.moves.inventoryOutput();

    private String cid;
    private String meidField = "pricview_id";
    ///editaFroCoby

    ac.engin.moves.pricView s = new ac.engin.moves.pricView();
    String REPORTFile = REPORT_priceview_file_print;
    String SQlFile = SQL_PRICVIEWMoveFile;
    String STATUSREPORT = REPORT_priceview_status;
    String SQLMOVEALL = SQL_PRICVIEWMoveAll;
    ac.engin.index ix = new ac.engin.index();
    ac.uitls.data d = new ac.uitls.data();

    ///editaFroCoby
    public pricView(String Status, String Bid) {
        initComponents();

        jd_date.setDate(new Date());
        s.serachTabel = jtab_index;

        ac.uitls.data d = new ac.uitls.data();

        updateUlabels();
        s.reportIndex = jtab_rep_names;

        ac.ui.utils.ComponentsEnable(sellitemPanel.getComponents(), false);
        ac.ui.utils.ComponentsEnable(sell_panel.getComponents(), false);
        jtxt_code.setTable(s.TabelString);

        onLoad();
        resetMe();

        updateStatus(Status, Bid);

        updateSellItemsData();

        ac.ui.utils.comBoxFills(jcom_searchItems, ac.uitls.data.addValueToArray(s.dataSaveFields, 0, ""), ac.uitls.data.addValueToArray(d.updateArrayLang(s.dataSaveFields), 0, ""));

        updateSellData();

        ac.ui.utils.comBoxFills(jcom_search, ac.uitls.data.addValueToArray(s.dataSaveFields, 0, ""), ac.uitls.data.addValueToArray(d.updateArrayLang(s.dataSaveFields), 0, ""));
        deleteAttars();
    }

    //<editor-fold defaultstate="collapsed" desc="my Code">
    private void updatePric() {
        String pid = custemItmes.comBoxGetValue(jcom_produest);
        if (pid != null && !pid.equals("") && !pid.equals("null") && !pid.equals(jcom_produest.addvalue)) {
            ///editaFroCoby
            double price = p.getMaxSellPric(pid);

            double quantity = Double.parseDouble(jsp_quantity.getValue().toString());
            jsp_unityPric.setValue(new Double(price));

            double upric = Double.parseDouble(jsp_unityPric.getValue().toString());
            jsp_price.setValue(new Double(upric * quantity));
        }
    }

    private void updateInfo() {
        s.Where = " `" + meidField + "`=" + thispid;
        s.serachTabel = jtab_index;
        s.indexsearch();

        String pricAll = s.getPricBill(thispid);
        if (pricAll != null && !pricAll.equalsIgnoreCase("")) {
            jlb_allPric.setText(pricAll);

            // jlb_allPricText.setText(arabicNumberToWords.convert(Long.parseLong(pricAll)));
        }
    }

    void myDoProssItems(String itemId) {

        String myBillId = s.getBillID(itemId);
        if (s.getStatus(myBillId).equals("1")) {

            String[] prossData = s.getMove(myBillId);
            String Cid = prossData[1];
            double a = Double.parseDouble(s.getPris(itemId));
            s.doProcess(Cid, a);
            index.updateCinfo(Cid, true);
        }

    }

    void myDoPross(String itemId) {
        String Status = s.getStatus(itemId);

        s.resItems(itemId);

        if (Status.equals("1")) {
            double a = Double.parseDouble(s.getPricBill(itemId));

            String[] prossData = s.getMove(itemId);
            String Cid = prossData[1];

            //Process
            s.doProcess(Cid, a);
            //Process  

            index.updateCinfo(Cid, true);

        }

    }

    private void clearInfo() {

       jtab_index.clear();

        jlb_allPric.setText("0");

        jlb_allPricText.setText("");
    }

    private void resetMe() {
        thispid = "0";
        ac.uitls.data d = new ac.uitls.data();
        s.actionStatus = 0;
        updateSellItemsData();
        s.clerPanels(true);
        s.EnablePanels(false);

        updateSellData();
        s.clerPanels(true);
        s.EnablePanels(false);

        clearInfo();
        ac.ui.utils.ComponentsEnable(sellitemPanel.getComponents(), false);
        ac.ui.utils.ComponentsEnable(sell_panel.getComponents(), false);

    }

    void updateUlabels() {
        jtab_data.setTitleAt(1, po.getWord("label.thisSearch"));
        jtab_data.setTitleAt(0, po.getWord("label.home"));
        jtab_data.setTitleAt(2, po.getWord("label.threportes"));
        jp_retportTaype.setBorder(javax.swing.BorderFactory.createTitledBorder(po.getWord("label.reptype")));
        jp_retportNames.setBorder(javax.swing.BorderFactory.createTitledBorder(po.getWord("label.repnames")));
        jp_retportcon.setBorder(javax.swing.BorderFactory.createTitledBorder(po.getWord("label.repoptions")));

    }

    void EditemSearch() {

        s.IndexID = Integer.parseInt(jtab_sellserach.getValue());
        thispid = "" + s.IndexID;
        ac.ui.utils.ComponentsEnable(sellitemPanel.getComponents(), true);
        updateStatus("update", jtab_sellserach.getValue());

    }

    public void updateStatus(String Status, String Bid) {
        if (Status.equals("update") && !Bid.equals("")) {
            thispid = Bid;
            updateSellItemsData();
            updateInfo();

            updateSellData();
            jtxt_code.setChiked(false);
            s.FrameDataupdateByid(Integer.parseInt(thispid));
            jtab_data.setSelectedIndex(0);
            jlb_orderID.setText(s.getOrderID(thispid));
            cid = s.getMove(thispid)[1];
            ac.ui.utils.ComponentsEnable(sellitemPanel.getComponents(), true);
        }
    }

    String thispid = "0";

    void updateSellItemSearch() {

        updateSellItemsData();
        String mid = jtab_sellserach.getValue();
        ac.GUI.index.updateCinfo(s.getMove(mid)[1], true);

        if (s.getStatus(mid).equals("1")) {
            jlb_status.setText(po.getWord("label.statusDone"));
        } else {
            jlb_status.setText(po.getWord("label.statusNotDone"));

        }

        s.Where = " `" + meidField + "`=" + mid;
        s.serachTabel = jtab_sellItemserach;
        s.indexsearch();

    }

    private void updateSellData() {
        s.ActionsButtons.clear();
        ///editaFroCoby
        s.TabelString = TABLE_PRICEVIEW;
        s.deleteTabel = jtab_indexDelete;
        s.dataComponents = new Component[]{jtxt_code, jcom_client, jcom_client, jd_date, jcom_paytype};;
        s.dataSaveFields = new String[]{"code", "client_title", "client", "date", "payType"};
        s.dataViewAS = new String[]{"id_hide", "_minWadth", "_maxWadth", "_hide", "date_", "addsID_"};

        s.ActionsButtons.put("add", jbt_add);
        s.ActionsButtons.put("delete", jbt_delete1);

        s.dataSaveAs = new String[]{"", "text"};
        // s.ActionsButtons.put("delete", jbt_delete);
        s.dataSaveValues = ac.ui.utils.getDataFromComss(s.dataComponents, s.dataSaveAs);
        s.panels = new JPanel[]{sell_panel};
        jtxt_code.setTable(s.TabelString);

    }

    private void updateSellItemsData() {
        s.ActionsButtons.clear();
        s.deleteTabel = jtab_indexDeleteItesm;
        ///editaFroCoby
        s.TabelString = TABLE_sales_items;

        s.dataComponents = new Component[]{jcom_produest, jcom_produest, jcom_quantityType, jsp_quantity, jsp_unityPric, jsp_price, jcom_inventory, ja_sn, ja_more};
        s.dataSaveFields = new String[]{"product", "product_title", "quantity_type", "quantity", "unity_pric", "price", "inventory", "sn", "notes", meidField};

        s.dataViewAS = new String[]{"id_", "_hide", "_maxWadth", "addsID_midWidth", "_midWidth", "_midWidth", "_midWidth", "addsTreeID_midWidth", "_midWidth", "_hide", "_hide"};

        s.panels = new JPanel[]{sellitemPanel};
        s.ActionsButtons.put("add", jbt_add3);
        s.ActionsButtons.put("edit", jbt_edit3);
        s.ActionsButtons.put("delete", jbt_delete3);
        s.dataSaveAs = new String[]{"", "text"};

        //if (s.actionStatus == 1) {
        String[] datab = ac.ui.utils.getDataFromComss(s.dataComponents, s.dataSaveAs);

        s.dataSaveValues = ac.uitls.data.addValueToArray(datab, 9, thispid);

        /**
         *
         * jcom_searchItems
         */
        //}
    }

    void deleteItem() {

        updateSellItemsData();

        if (s.setdeleteStatus(true, false, false) > 0) {

        }

    }

    void deleteAttars() {

        jtab_data.setTitleAt(3, po.getWord("label.deletefiles"));
        jtab_data.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {

                if (jtab_data.getSelectedIndex() == 3) {
                    updateSellData();
                    s.indexdelete();

                    updateSellItemsData();
                    s.indexdelete();

                }
            }
        });

    }
//</editor-fold>

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jtab_data = new ac.ui.controls.PCLTabs();
        jPanel1 = new PCLPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jtab_index = new ac.ui.controls.PCLTable();
        pCLToolbar5 = new ac.ui.controls.PCLToolbar();
        jlb_allPric1 = new ac.ui.controls.PCLLabel();
        jlb_allPricText1 = new ac.ui.controls.PCLLabel();
        jlb_allPric = new ac.ui.controls.PCLLabel();
        jlb_allPricText = new ac.ui.controls.PCLLabel();
        jlb_allPric2 = new ac.ui.controls.PCLLabel();
        pCLButton2 = new ac.ui.controls.PCLButton();
        sellitemPanel = new ac.ui.controls.PCLPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        ja_sn = new ac.ui.controls.PCLTextarea();
        pCLLabel11 = new ac.ui.controls.PCLLabel();
        pCLLabel12 = new ac.ui.controls.PCLLabel();
        jcom_produest = new ac.ui.controls.PCLGetdata();
        pCLLabel13 = new ac.ui.controls.PCLLabel();
        jsp_price = new ac.ui.controls.PCLSpinner();
        pCLLabel14 = new ac.ui.controls.PCLLabel();
        jcom_quantityType = new ac.ui.controls.PCLcomboboxAdd();
        pCLLabel15 = new ac.ui.controls.PCLLabel();
        jsp_quantity = new ac.ui.controls.PCLSpinner();
        pCLLabel16 = new ac.ui.controls.PCLLabel();
        pCLToolbar7 = new ac.ui.controls.PCLToolbar();
        jbt_add3 = new ac.ui.controls.PCLButton();
        jbt_edit3 = new ac.ui.controls.PCLButton();
        jbt_delete3 = new ac.ui.controls.PCLButton();
        jbt_cancel3 = new ac.ui.controls.PCLButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        jbt_add4 = new ac.ui.controls.PCLButton();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        jbt_add6 = new ac.ui.controls.PCLButton();
        jlb_orderID = new ac.ui.controls.PCLLabel();
        jbt_add7 = new ac.ui.controls.PCLButton();
        jlb_billID = new javax.swing.JLabel();
        jcom_inventory = new ac.ui.controls.PCLGetdataFull();
        jsp_unityPric = new ac.ui.controls.PCLSpinner();
        pCLLabel25 = new ac.ui.controls.PCLLabel();
        jScrollPane11 = new javax.swing.JScrollPane();
        ja_more = new ac.ui.controls.PCLTextarea();
        pCLLabel26 = new ac.ui.controls.PCLLabel();
        sell_panel = new ac.ui.controls.PCLPanel();
        pCLLabel17 = new ac.ui.controls.PCLLabel();
        pCLLabel18 = new ac.ui.controls.PCLLabel();
        jcom_client = new ac.ui.controls.PCLGetdata();
        jcom_paytype = new ac.ui.controls.PCLcomboboxAdd();
        jd_date = new org.jdesktop.swingx.JXDatePicker();
        pCLLabel19 = new ac.ui.controls.PCLLabel();
        pCLLabel20 = new ac.ui.controls.PCLLabel();
        jtxt_code = new ac.ui.controls.PCLCode();
        pCLToolbar6 = new ac.ui.controls.PCLToolbar();
        jbt_add = new ac.ui.controls.PCLButton();
        jbt_cancel4 = new ac.ui.controls.PCLButton();
        jbt_print = new ac.ui.controls.PCLButton();
        pCLPanel1 = new ac.ui.controls.PCLPanel();
        pCLToolbar8 = new ac.ui.controls.PCLToolbar();
        jbt_edit1 = new ac.ui.controls.PCLButton();
        jbt_delete1 = new ac.ui.controls.PCLButton();
        jbt_print1 = new ac.ui.controls.PCLButton();
        jlb_status = new ac.ui.controls.PCLLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jtab_sellserach = new ac.ui.controls.PCLTable();
        jScrollPane6 = new javax.swing.JScrollPane();
        jtab_sellItemserach = new ac.ui.controls.PCLTable();
        pCLPanel2 = new ac.ui.controls.PCLPanel();
        jd_from = new ac.ui.controls.PCLDate();
        jd_To = new ac.ui.controls.PCLDate();
        pCLLabel21 = new ac.ui.controls.PCLLabel();
        pCLLabel22 = new ac.ui.controls.PCLLabel();
        pCLButton1 = new ac.ui.controls.PCLButton();
        jtxt_search = new ac.ui.controls.PCLTextField();
        jcom_search = new ac.ui.controls.PCLcomboBox();
        pCLLabel1 = new ac.ui.controls.PCLLabel();
        pCLLabel2 = new ac.ui.controls.PCLLabel();
        pCLLabel4 = new ac.ui.controls.PCLLabel();
        jcom_searchItems = new ac.ui.controls.PCLcomboBox();
        pCLToolbar9 = new ac.ui.controls.PCLToolbar();
        jbt_edit2 = new ac.ui.controls.PCLButton();
        jbt_delete2 = new ac.ui.controls.PCLButton();
        jbt_edit4 = new ac.ui.controls.PCLButton();
        jPanel5 = new javax.swing.JPanel();
        jp_retportNames = new ac.ui.controls.PCLPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        jtab_rep_names = new ac.ui.controls.PCLTable();
        jScrollPane9 = new javax.swing.JScrollPane();
        jtr_rep_category = new ac.ui.controls.PCLTree();
        jp_retportTaype = new ac.ui.controls.PCLPanel();
        jScrollPane8 = new javax.swing.JScrollPane();
        jtr_rep_type = new ac.ui.controls.PCLTree();
        jScrollPane10 = new javax.swing.JScrollPane();
        pCLTextarea1 = new ac.ui.controls.PCLTextarea();
        jp_retportcon = new ac.ui.controls.PCLPanel();
        jd_rep_view = new ac.ui.controls.PCLButton();
        jd_rep_to = new ac.ui.controls.PCLDate();
        pCLLabel23 = new ac.ui.controls.PCLLabel();
        jd_rep_from = new ac.ui.controls.PCLDate();
        pCLLabel24 = new ac.ui.controls.PCLLabel();
        jlb_repTitle = new ac.ui.controls.PCLLabel();
        pCLPanel4 = new ac.ui.controls.PCLPanel();
        pCLPanel3 = new ac.ui.controls.PCLPanel();
        jScrollPane13 = new javax.swing.JScrollPane();
        jtab_indexDeleteItesm = new ac.ui.controls.PCLTable();
        pCLToolbar10 = new ac.ui.controls.PCLToolbar();
        jbt_removeItems = new ac.ui.controls.PCLButton();
        jbt_removeAllItems = new ac.ui.controls.PCLButton();
        jbt_restoreItems = new ac.ui.controls.PCLButton();
        jbt_restoreAllItems = new ac.ui.controls.PCLButton();
        pCLPanel5 = new ac.ui.controls.PCLPanel();
        jScrollPane14 = new javax.swing.JScrollPane();
        jtab_indexDelete = new ac.ui.controls.PCLTable();
        pCLToolbar11 = new ac.ui.controls.PCLToolbar();
        jbt_remove = new ac.ui.controls.PCLButton();
        jbt_removeAll = new ac.ui.controls.PCLButton();
        jbt_restore = new ac.ui.controls.PCLButton();
        jbt_restoreAll = new ac.ui.controls.PCLButton();

        setType("sell");

        jtab_data.setTabPlacement(javax.swing.JTabbedPane.RIGHT);

        jtab_index.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        jScrollPane3.setViewportView(jtab_index);

        pCLToolbar5.setRollover(true);

        jlb_allPric1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jlb_allPric1.setText("jlb_allPric");
        jlb_allPric1.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        jlb_allPric1.setFontBold(true);
        pCLToolbar5.add(jlb_allPric1);

        jlb_allPricText1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jlb_allPricText1.setText(":");
        jlb_allPricText1.setFontBold(true);
        pCLToolbar5.add(jlb_allPricText1);

        jlb_allPric.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jlb_allPric.setText("0");
        jlb_allPric.setFontBold(true);
        pCLToolbar5.add(jlb_allPric);

        jlb_allPricText.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jlb_allPricText.setText("0");
        jlb_allPricText.setFont(new java.awt.Font("Monospaced", 0, 15)); // NOI18N
        jlb_allPricText.setFontBold(true);
        pCLToolbar5.add(jlb_allPricText);

        jlb_allPric2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jlb_allPric2.setText("jlb_pound");
        jlb_allPric2.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
        jlb_allPric2.setFontBold(true);
        pCLToolbar5.add(jlb_allPric2);

        pCLButton2.setType("mony");
        pCLButton2.setFocusable(false);
        pCLButton2.setHorizontalTextPosition(0);
        pCLButton2.setText("jlb_Installment");
        pCLButton2.setVerticalTextPosition(3);
        pCLButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pCLButton2ActionPerformed(evt);
            }
        });
        pCLToolbar5.add(pCLButton2);

        sellitemPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        ja_sn.setColumns(20);
        ja_sn.setRows(5);
        jScrollPane4.setViewportView(ja_sn);

        pCLLabel11.setText("jlb_more");

        pCLLabel12.setText("jlb_product");

        jcom_produest.setAddtype("products");
        jcom_produest.setRequired(true);
        jcom_produest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcom_produestActionPerformed(evt);
            }
        });
        jcom_produest.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jcom_produestMouseClicked(evt);
            }
        });

        pCLLabel13.setText("jlb_price");

        jsp_price.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jsp_priceStateChanged(evt);
            }
        });

        pCLLabel14.setText("jlb_quantityType");

        jcom_quantityType.setAddtype("quantityType");
        jcom_quantityType.setRequired(true);
        jcom_quantityType.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcom_quantityTypeActionPerformed(evt);
            }
        });

        pCLLabel15.setText("jlb_quantity");

        jsp_quantity.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jsp_quantityMouseClicked(evt);
            }
        });
        jsp_quantity.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jsp_quantityStateChanged(evt);
            }
        });

        pCLLabel16.setText("jlb_inventory");

        pCLToolbar7.setRollover(true);

        jbt_add3.setType("add");
        jbt_add3.setFocusable(false);
        jbt_add3.setMargin(new java.awt.Insets(5, 5, 5, 5));
        jbt_add3.setText("jbt_addItem");
        jbt_add3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_add3ActionPerformed(evt);
            }
        });
        pCLToolbar7.add(jbt_add3);

        jbt_edit3.setType("edit");
        jbt_edit3.setFocusable(false);
        jbt_edit3.setMargin(new java.awt.Insets(5, 5, 5, 5));
        jbt_edit3.setText("jbt_editItem");
        jbt_edit3.setVerticalTextPosition(3);
        jbt_edit3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_edit3ActionPerformed(evt);
            }
        });
        pCLToolbar7.add(jbt_edit3);

        jbt_delete3.setType("delete");
        jbt_delete3.setFocusable(false);
        jbt_delete3.setMargin(new java.awt.Insets(5, 5, 5, 5));
        jbt_delete3.setText("jbt_deleteItem");
        jbt_delete3.setVerticalTextPosition(3);
        jbt_delete3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_delete3ActionPerformed(evt);
            }
        });
        pCLToolbar7.add(jbt_delete3);

        jbt_cancel3.setType("cancel");
        jbt_cancel3.setFocusable(false);
        jbt_cancel3.setMargin(new java.awt.Insets(5, 5, 5, 5));
        jbt_cancel3.setText("jbt_cancel");
        jbt_cancel3.setVerticalTextPosition(3);
        jbt_cancel3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_cancel3ActionPerformed(evt);
            }
        });
        pCLToolbar7.add(jbt_cancel3);
        pCLToolbar7.add(jSeparator1);

        jbt_add4.setType("save");
        jbt_add4.setFocusable(false);
        jbt_add4.setMargin(new java.awt.Insets(5, 5, 5, 5));
        jbt_add4.setText("jbt_save");
        jbt_add4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_add4ActionPerformed(evt);
            }
        });
        pCLToolbar7.add(jbt_add4);
        pCLToolbar7.add(jSeparator2);

        jbt_add6.setType("add");
        jbt_add6.setFocusable(false);
        jbt_add6.setMargin(new java.awt.Insets(5, 5, 5, 5));
        jbt_add6.setText("jbt_creatIOrder");
        jbt_add6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_add6ActionPerformed(evt);
            }
        });
        pCLToolbar7.add(jbt_add6);

        jlb_orderID.setBackground(java.awt.Color.gray);
        jlb_orderID.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jlb_orderID.setText("0");
        jlb_orderID.setMaximumSize(new java.awt.Dimension(100, 20));
        jlb_orderID.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlb_orderIDMouseClicked(evt);
            }
        });
        pCLToolbar7.add(jlb_orderID);

        jbt_add7.setType("add");
        jbt_add7.setFocusable(false);
        jbt_add7.setMargin(new java.awt.Insets(5, 5, 5, 5));
        jbt_add7.setText("jlb_creatIsellBill");
        jbt_add7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_add7ActionPerformed(evt);
            }
        });
        pCLToolbar7.add(jbt_add7);

        jlb_billID.setText("0");
        jlb_billID.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jlb_billID.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jlb_billIDMouseClicked(evt);
            }
        });
        pCLToolbar7.add(jlb_billID);

        jcom_inventory.setRequired(true);
        jcom_inventory.setAddtype("inventory");
        jcom_inventory.setCategory(true);
        jcom_inventory.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcom_inventoryActionPerformed(evt);
            }
        });

        jsp_unityPric.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jsp_unityPricMouseClicked(evt);
            }
        });
        jsp_unityPric.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jsp_unityPricStateChanged(evt);
            }
        });

        pCLLabel25.setText("jlb_unityPric");

        ja_more.setColumns(20);
        ja_more.setRows(5);
        jScrollPane11.setViewportView(ja_more);

        pCLLabel26.setText("jlb_SN");

        javax.swing.GroupLayout sellitemPanelLayout = new javax.swing.GroupLayout(sellitemPanel);
        sellitemPanel.setLayout(sellitemPanelLayout);
        sellitemPanelLayout.setHorizontalGroup(
            sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sellitemPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(sellitemPanelLayout.createSequentialGroup()
                        .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(sellitemPanelLayout.createSequentialGroup()
                                .addComponent(pCLLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane4))
                            .addGroup(sellitemPanelLayout.createSequentialGroup()
                                .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(pCLLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jcom_quantityType, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(16, 16, 16)
                                .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jsp_quantity, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(pCLLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pCLLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(6, 6, 6))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, sellitemPanelLayout.createSequentialGroup()
                        .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(pCLLabel12, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jcom_produest, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(45, 45, 45)))
                .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane11)
                    .addComponent(jcom_inventory, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(sellitemPanelLayout.createSequentialGroup()
                        .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(pCLLabel25, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jsp_unityPric, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jsp_price, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(pCLLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addComponent(pCLLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(sellitemPanelLayout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(pCLToolbar7, javax.swing.GroupLayout.DEFAULT_SIZE, 1553, Short.MAX_VALUE))
        );
        sellitemPanelLayout.setVerticalGroup(
            sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sellitemPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pCLLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jcom_inventory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcom_produest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pCLLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jsp_unityPric, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jsp_price, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jsp_quantity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcom_quantityType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(sellitemPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(pCLLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
                    .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(pCLToolbar7, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        sell_panel.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray));

        pCLLabel17.setText("jlb_code");

        pCLLabel18.setText("jlb_client");

        jcom_client.setAddtype("clients");
        jcom_client.setRequired(true);
        jcom_client.setToolTipText("");
        jcom_client.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcom_clientActionPerformed(evt);
            }
        });

        jcom_paytype.setAddtype("paytape");
        jcom_paytype.setRequired(true);
        jcom_paytype.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcom_paytypeActionPerformed(evt);
            }
        });

        pCLLabel19.setText("jlb_date");

        pCLLabel20.setText("jlb_payType");

        jtxt_code.setAuto(true);
        jtxt_code.setTable("sales");

        pCLToolbar6.setRollover(true);

        jbt_add.setType("add");
        jbt_add.setFocusable(false);
        jbt_add.setText("jbt_add");
        jbt_add.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_addActionPerformed(evt);
            }
        });
        pCLToolbar6.add(jbt_add);

        jbt_cancel4.setType("cancel");
        jbt_cancel4.setFocusable(false);
        jbt_cancel4.setMargin(new java.awt.Insets(5, 5, 5, 5));
        jbt_cancel4.setText("jbt_cancel");
        jbt_cancel4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_cancel4ActionPerformed(evt);
            }
        });
        pCLToolbar6.add(jbt_cancel4);

        jbt_print.setType("print");
        jbt_print.setFocusable(false);
        jbt_print.setText("jbt_print");
        jbt_print.setVerticalTextPosition(3);
        jbt_print.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_printActionPerformed(evt);
            }
        });
        pCLToolbar6.add(jbt_print);

        javax.swing.GroupLayout sell_panelLayout = new javax.swing.GroupLayout(sell_panel);
        sell_panel.setLayout(sell_panelLayout);
        sell_panelLayout.setHorizontalGroup(
            sell_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sell_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(sell_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pCLToolbar6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(sell_panelLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(pCLLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(2, 2, 2)
                        .addComponent(jtxt_code, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(pCLLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jd_date, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(12, 12, 12)
                        .addComponent(pCLLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jcom_client, javax.swing.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addComponent(pCLLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcom_paytype, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        sell_panelLayout.setVerticalGroup(
            sell_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sell_panelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(sell_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jtxt_code, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcom_paytype, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcom_client, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pCLLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jd_date, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pCLToolbar6, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(pCLToolbar5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(sell_panel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
            .addComponent(sellitemPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(sell_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(sellitemPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pCLToolbar5, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jtab_data.addTab("tab1", jPanel1);

        pCLToolbar8.setRollover(true);

        jbt_edit1.setType("edit");
        jbt_edit1.setFocusable(false);
        jbt_edit1.setText("jbt_edit");
        jbt_edit1.setVerticalTextPosition(3);
        jbt_edit1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_edit1ActionPerformed(evt);
            }
        });
        pCLToolbar8.add(jbt_edit1);

        jbt_delete1.setType("delete");
        jbt_delete1.setFocusable(false);
        jbt_delete1.setText("jbt_delete");
        jbt_delete1.setVerticalTextPosition(3);
        jbt_delete1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_delete1ActionPerformed(evt);
            }
        });
        pCLToolbar8.add(jbt_delete1);

        jbt_print1.setType("print");
        jbt_print1.setFocusable(false);
        jbt_print1.setText("jbt_print");
        jbt_print1.setVerticalTextPosition(3);
        jbt_print1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_print1ActionPerformed(evt);
            }
        });
        pCLToolbar8.add(jbt_print1);
        pCLToolbar8.add(jlb_status);

        jtab_sellserach.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        jtab_sellserach.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jtab_sellserachMouseClicked(evt);
            }
        });
        jScrollPane5.setViewportView(jtab_sellserach);

        jtab_sellItemserach.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        jtab_sellItemserach.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jtab_sellItemserachMouseClicked(evt);
            }
        });
        jScrollPane6.setViewportView(jtab_sellItemserach);

        pCLPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));

        pCLLabel21.setText("jlb_From");

        pCLLabel22.setText("jlb_To");

        pCLButton1.setText("jbt_search");
        pCLButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pCLButton1ActionPerformed(evt);
            }
        });

        pCLLabel1.setText("jlb_searchIn");

        pCLLabel2.setText("jlb_searchWord");

        pCLLabel4.setText("jlb_searchIn");

        javax.swing.GroupLayout pCLPanel2Layout = new javax.swing.GroupLayout(pCLPanel2);
        pCLPanel2.setLayout(pCLPanel2Layout);
        pCLPanel2Layout.setHorizontalGroup(
            pCLPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pCLPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pCLPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jtxt_search, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pCLLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcom_searchItems, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pCLLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcom_search, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pCLLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jd_To, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pCLLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jd_from, javax.swing.GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE)
                    .addComponent(pCLLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(pCLButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        pCLPanel2Layout.setVerticalGroup(
            pCLPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pCLPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pCLLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jd_from, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pCLLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(9, 9, 9)
                .addComponent(jd_To, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(79, 79, 79)
                .addComponent(pCLLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jcom_search, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(3, 3, 3)
                .addComponent(pCLLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jcom_searchItems, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(pCLLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jtxt_search, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(pCLButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pCLToolbar9.setRollover(true);

        jbt_edit2.setType("edit");
        jbt_edit2.setFocusable(false);
        jbt_edit2.setText("jbt_edit");
        jbt_edit2.setVerticalTextPosition(3);
        jbt_edit2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_edit2ActionPerformed(evt);
            }
        });
        pCLToolbar9.add(jbt_edit2);

        jbt_delete2.setType("delete");
        jbt_delete2.setFocusable(false);
        jbt_delete2.setText("jbt_delete");
        jbt_delete2.setVerticalTextPosition(3);
        jbt_delete2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_delete2ActionPerformed(evt);
            }
        });
        pCLToolbar9.add(jbt_delete2);

        jbt_edit4.setType("edit");
        jbt_edit4.setFocusable(false);
        jbt_edit4.setText("jbt_reback");
        jbt_edit4.setVerticalTextPosition(3);
        jbt_edit4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_edit4ActionPerformed(evt);
            }
        });
        pCLToolbar9.add(jbt_edit4);

        javax.swing.GroupLayout pCLPanel1Layout = new javax.swing.GroupLayout(pCLPanel1);
        pCLPanel1.setLayout(pCLPanel1Layout);
        pCLPanel1Layout.setHorizontalGroup(
            pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pCLPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pCLPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pCLToolbar8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 664, Short.MAX_VALUE)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(pCLToolbar9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        pCLPanel1Layout.setVerticalGroup(
            pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pCLPanel1Layout.createSequentialGroup()
                .addGroup(pCLPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pCLPanel1Layout.createSequentialGroup()
                        .addComponent(pCLToolbar8, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(pCLToolbar9, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 548, Short.MAX_VALUE))
                    .addComponent(pCLPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jtab_data.addTab("tab2", pCLPanel1);

        jp_retportNames.setBorder(javax.swing.BorderFactory.createTitledBorder("aaaaa"));

        jtab_rep_names.setType("index");
        jtab_rep_names.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jtab_rep_namesMouseClicked(evt);
            }
        });
        jtab_rep_names.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jtab_rep_namesKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jtab_rep_namesKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jtab_rep_namesKeyTyped(evt);
            }
        });
        jScrollPane7.setViewportView(jtab_rep_names);

        javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("root");
        jtr_rep_category.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
        jtr_rep_category.setAddtype("clientsCat");
        jtr_rep_category.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
            public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
                jtr_rep_categoryValueChanged(evt);
            }
        });
        jScrollPane9.setViewportView(jtr_rep_category);

        javax.swing.GroupLayout jp_retportNamesLayout = new javax.swing.GroupLayout(jp_retportNames);
        jp_retportNames.setLayout(jp_retportNamesLayout);
        jp_retportNamesLayout.setHorizontalGroup(
            jp_retportNamesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
            .addComponent(jScrollPane9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE)
        );
        jp_retportNamesLayout.setVerticalGroup(
            jp_retportNamesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jp_retportNamesLayout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
        );

        jp_retportTaype.setBorder(javax.swing.BorderFactory.createTitledBorder("aaaaa"));
        jp_retportTaype.setPreferredSize(new java.awt.Dimension(200, 282));

        treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("root");
        jtr_rep_type.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
        jtr_rep_type.setAddtype("sellRepType");
        jtr_rep_type.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
            public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
                jtr_rep_typeValueChanged(evt);
            }
        });
        jScrollPane8.setViewportView(jtr_rep_type);

        pCLTextarea1.setBackground(new java.awt.Color(255, 255, 204));
        pCLTextarea1.setColumns(20);
        pCLTextarea1.setRows(5);
        jScrollPane10.setViewportView(pCLTextarea1);

        javax.swing.GroupLayout jp_retportTaypeLayout = new javax.swing.GroupLayout(jp_retportTaype);
        jp_retportTaype.setLayout(jp_retportTaypeLayout);
        jp_retportTaypeLayout.setHorizontalGroup(
            jp_retportTaypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane8)
            .addComponent(jScrollPane10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 635, Short.MAX_VALUE)
        );
        jp_retportTaypeLayout.setVerticalGroup(
            jp_retportTaypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jp_retportTaypeLayout.createSequentialGroup()
                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 283, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane10, javax.swing.GroupLayout.DEFAULT_SIZE, 482, Short.MAX_VALUE))
        );

        jp_retportcon.setBorder(javax.swing.BorderFactory.createTitledBorder("aaaaa"));

        jd_rep_view.setText("jbt_search");
        jd_rep_view.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jd_rep_viewActionPerformed(evt);
            }
        });

        pCLLabel23.setText("jlb_To");

        pCLLabel24.setText("jlb_From");

        javax.swing.GroupLayout jp_retportconLayout = new javax.swing.GroupLayout(jp_retportcon);
        jp_retportcon.setLayout(jp_retportconLayout);
        jp_retportconLayout.setHorizontalGroup(
            jp_retportconLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jd_rep_view, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
            .addComponent(jd_rep_to, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jd_rep_from, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jp_retportconLayout.createSequentialGroup()
                .addComponent(pCLLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(jp_retportconLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pCLLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jp_retportconLayout.setVerticalGroup(
            jp_retportconLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jp_retportconLayout.createSequentialGroup()
                .addGap(17, 17, 17)
                .addComponent(pCLLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jd_rep_from, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pCLLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jd_rep_to, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jd_rep_view, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jlb_repTitle.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jlb_repTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlb_repTitle.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jlb_repTitle.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jp_retportTaype, javax.swing.GroupLayout.DEFAULT_SIZE, 647, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jp_retportNames, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jp_retportcon, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jlb_repTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jlb_repTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jp_retportTaype, javax.swing.GroupLayout.DEFAULT_SIZE, 794, Short.MAX_VALUE)
                    .addComponent(jp_retportNames, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jp_retportcon, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jtab_data.addTab("tab3", jPanel5);

        jtab_indexDeleteItesm.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        jtab_indexDeleteItesm.setType("index");
        jtab_indexDeleteItesm.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jtab_indexDeleteItesmMouseClicked(evt);
            }
        });
        jtab_indexDeleteItesm.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jtab_indexDeleteItesmPropertyChange(evt);
            }
        });
        jtab_indexDeleteItesm.addInputMethodListener(new java.awt.event.InputMethodListener() {
            public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
                jtab_indexDeleteItesmCaretPositionChanged(evt);
            }
            public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
            }
        });
        jtab_indexDeleteItesm.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jtab_indexDeleteItesmKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jtab_indexDeleteItesmKeyTyped(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jtab_indexDeleteItesmKeyReleased(evt);
            }
        });
        jtab_indexDeleteItesm.addVetoableChangeListener(new java.beans.VetoableChangeListener() {
            public void vetoableChange(java.beans.PropertyChangeEvent evt)throws java.beans.PropertyVetoException {
                jtab_indexDeleteItesmVetoableChange(evt);
            }
        });
        jScrollPane13.setViewportView(jtab_indexDeleteItesm);

        pCLToolbar10.setRollover(true);

        jbt_removeItems.setType("remove");
        jbt_removeItems.setFocusable(false);
        jbt_removeItems.setText("jbt_remove");
        jbt_removeItems.setVerticalTextPosition(3);
        jbt_removeItems.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_removeItemsActionPerformed(evt);
            }
        });
        pCLToolbar10.add(jbt_removeItems);

        jbt_removeAllItems.setType("removeAll");
        jbt_removeAllItems.setFocusable(false);
        jbt_removeAllItems.setText("jbt_removeAll");
        jbt_removeAllItems.setVerticalTextPosition(3);
        jbt_removeAllItems.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_removeAllItemsActionPerformed(evt);
            }
        });
        pCLToolbar10.add(jbt_removeAllItems);

        jbt_restoreItems.setType("restore");
        jbt_restoreItems.setFocusable(false);
        jbt_restoreItems.setText("jbt_restore");
        jbt_restoreItems.setVerticalTextPosition(3);
        jbt_restoreItems.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_restoreItemsActionPerformed(evt);
            }
        });
        pCLToolbar10.add(jbt_restoreItems);

        jbt_restoreAllItems.setType("restoreAll");
        jbt_restoreAllItems.setFocusable(false);
        jbt_restoreAllItems.setText("jbt_restoreAll");
        jbt_restoreAllItems.setVerticalTextPosition(3);
        jbt_restoreAllItems.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_restoreAllItemsActionPerformed(evt);
            }
        });
        pCLToolbar10.add(jbt_restoreAllItems);

        javax.swing.GroupLayout pCLPanel3Layout = new javax.swing.GroupLayout(pCLPanel3);
        pCLPanel3.setLayout(pCLPanel3Layout);
        pCLPanel3Layout.setHorizontalGroup(
            pCLPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pCLPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 1527, Short.MAX_VALUE)
                .addContainerGap())
            .addComponent(pCLToolbar10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        pCLPanel3Layout.setVerticalGroup(
            pCLPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pCLPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pCLToolbar10, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 348, Short.MAX_VALUE)
                .addContainerGap())
        );

        jtab_indexDelete.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        jtab_indexDelete.setType("index");
        jtab_indexDelete.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jtab_indexDeleteMouseClicked(evt);
            }
        });
        jtab_indexDelete.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                jtab_indexDeletePropertyChange(evt);
            }
        });
        jtab_indexDelete.addInputMethodListener(new java.awt.event.InputMethodListener() {
            public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
                jtab_indexDeleteCaretPositionChanged(evt);
            }
            public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
            }
        });
        jtab_indexDelete.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jtab_indexDeleteKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jtab_indexDeleteKeyTyped(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jtab_indexDeleteKeyReleased(evt);
            }
        });
        jtab_indexDelete.addVetoableChangeListener(new java.beans.VetoableChangeListener() {
            public void vetoableChange(java.beans.PropertyChangeEvent evt)throws java.beans.PropertyVetoException {
                jtab_indexDeleteVetoableChange(evt);
            }
        });
        jScrollPane14.setViewportView(jtab_indexDelete);

        pCLToolbar11.setRollover(true);

        jbt_remove.setType("remove");
        jbt_remove.setFocusable(false);
        jbt_remove.setText("jbt_remove");
        jbt_remove.setVerticalTextPosition(3);
        jbt_remove.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_removeActionPerformed(evt);
            }
        });
        pCLToolbar11.add(jbt_remove);

        jbt_removeAll.setType("removeAll");
        jbt_removeAll.setFocusable(false);
        jbt_removeAll.setText("jbt_removeAll");
        jbt_removeAll.setVerticalTextPosition(3);
        jbt_removeAll.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_removeAllActionPerformed(evt);
            }
        });
        pCLToolbar11.add(jbt_removeAll);

        jbt_restore.setType("restore");
        jbt_restore.setFocusable(false);
        jbt_restore.setText("jbt_restore");
        jbt_restore.setVerticalTextPosition(3);
        jbt_restore.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_restoreActionPerformed(evt);
            }
        });
        pCLToolbar11.add(jbt_restore);

        jbt_restoreAll.setType("restoreAll");
        jbt_restoreAll.setFocusable(false);
        jbt_restoreAll.setText("jbt_restoreAll");
        jbt_restoreAll.setVerticalTextPosition(3);
        jbt_restoreAll.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbt_restoreAllActionPerformed(evt);
            }
        });
        pCLToolbar11.add(jbt_restoreAll);

        javax.swing.GroupLayout pCLPanel5Layout = new javax.swing.GroupLayout(pCLPanel5);
        pCLPanel5.setLayout(pCLPanel5Layout);
        pCLPanel5Layout.setHorizontalGroup(
            pCLPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pCLPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane14, javax.swing.GroupLayout.DEFAULT_SIZE, 1527, Short.MAX_VALUE)
                .addContainerGap())
            .addComponent(pCLToolbar11, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        pCLPanel5Layout.setVerticalGroup(
            pCLPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pCLPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pCLToolbar11, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane14, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout pCLPanel4Layout = new javax.swing.GroupLayout(pCLPanel4);
        pCLPanel4.setLayout(pCLPanel4Layout);
        pCLPanel4Layout.setHorizontalGroup(
            pCLPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pCLPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pCLPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pCLPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pCLPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        pCLPanel4Layout.setVerticalGroup(
            pCLPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pCLPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pCLPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(pCLPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jtab_data.addTab("tab4", pCLPanel4);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jtab_data, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jtab_data, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jbt_add3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_add3ActionPerformed
        if (!thispid.equals("0") && !thispid.equals("")) {
            updateSellItemsData();

            if (s.addStep2(true, true, true) > 0) {
                if (s.getStatus(thispid).equals("1")) {
                    String[] prossData = s.getMove(thispid);
                    String Cid = prossData[1];

                    Double a = Double.parseDouble(s.getPris(s.returnLastItemID()));
                    s.doProcess(Cid, a);

                }
            }

            updateInfo();
            ac.ui.utils.panelClaers(sellitemPanel.getComponents(), true);
        }
    }//GEN-LAST:event_jbt_add3ActionPerformed


    private void jbt_edit3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_edit3ActionPerformed

        if (s.actionStatus == 0) {

            s.IndexID = Integer.parseInt(jtab_index.getValue());
        }

        updateSellItemsData();
        s.FrameDataupdateByid(s.IndexID);

        s.setedit(true, false, false, true);

        updateInfo();
    }//GEN-LAST:event_jbt_edit3ActionPerformed

    private void jbt_delete3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_delete3ActionPerformed
        s.IndexID = Integer.parseInt(jtab_index.getValue());
        deleteItem();
        updateInfo();

    }//GEN-LAST:event_jbt_delete3ActionPerformed

    private void jbt_printActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_printActionPerformed

        updateSellData();
        s.setPrint(REPORTFile, SQlFile + thispid);

    }//GEN-LAST:event_jbt_printActionPerformed

    private void jbt_addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_addActionPerformed
        thispid = "";
        updateSellData();
        jtxt_code.setChiked(false);

        if (s.setnewRetuenSataus(true, false, false, true, false) > 0) {
            thispid = s.returnLastID();
            cid = custemItmes.comBoxGetValue(jcom_client);
            ac.ui.utils.ComponentsEnable(sellitemPanel.getComponents(), true);
            ac.ui.utils.ComponentsEnable(sell_panel.getComponents(), false);
        }

    }//GEN-LAST:event_jbt_addActionPerformed


    private void jbt_add4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_add4ActionPerformed
        resetMe();

    }//GEN-LAST:event_jbt_add4ActionPerformed


    private void jbt_add6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_add6ActionPerformed

        s.creatInventoryOrder(thispid, this);

    }//GEN-LAST:event_jbt_add6ActionPerformed

    private void jbt_edit1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_edit1ActionPerformed
        EditemSearch();

    }//GEN-LAST:event_jbt_edit1ActionPerformed

    private void jbt_delete1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_delete1ActionPerformed
        updateSellData();

        s.IndexID = Integer.parseInt(jtab_sellserach.getValue());
        thispid = "" + s.IndexID;

        String Status = s.getStatus("" + s.IndexID);

        if (Status.equals("1")) {
            double a = Double.parseDouble(s.getPricBill("" + s.IndexID));

            String[] prossData = s.getMove("" + s.IndexID);
            String Cid = prossData[1];

            if (utils.sendDeleteDoneMssage(this, po.getWord("label.clients")) == 0) {
                if (s.setdeleteStatus(true, false, false) == 1) {
                    //Process
                    s.reProcess(Cid, a);
                    //Process  
                    s.deletItems("" + s.IndexID);
                    pCLButton1ActionPerformed(null);

                    index.updateCinfo(Cid, true);

                } else {

                }
            }

        } else {

            if (s.setdeleteStatus(true, false, false) == 1) {
                s.deletItems("" + p.IndexID);
                pCLButton1ActionPerformed(null);
            }
        }


    }//GEN-LAST:event_jbt_delete1ActionPerformed

    private void jbt_print1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_print1ActionPerformed

        updateSellData();
        s.setPrint(REPORTFile, SQlFile + jtab_sellserach.getValue());
    }//GEN-LAST:event_jbt_print1ActionPerformed

    private void pCLButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pCLButton1ActionPerformed

        if (!ac.ui.utils.comBoxGetValue(jcom_searchItems).equals("")) {

            s.Where = "`" + ac.ui.utils.comBoxGetValue(jcom_searchItems) + "`like '%" + jtxt_search.getText() + "%' ";
            if (jd_from.getDate() != null && jd_from.getDate() != null) {

                s.Where += " and  " + ac.lib.data.dateTime.updateSerechDates("date", jd_from.getDate(), jd_To.getDate());

            }
            s.Where += "";
            if (s.Where.equals("")) {
                s.Where = "1=1";
            }
            updateSellItemsData();

            s.serachTabel = jtab_sellItemserach;

            s.indexsearch();
        } else {
            if (!ac.ui.utils.comBoxGetValue(jcom_search).equals("")) {
                s.Where = "`" + ac.ui.utils.comBoxGetValue(jcom_search) + "`like '%" + jtxt_search.getText() + "%' ";
            }
            if (jd_from.getDate() != null && jd_from.getDate() != null) {

                s.Where += " and  " + ac.lib.data.dateTime.updateSerechDates("date", jd_from.getDate(), jd_To.getDate());

            }
            s.Where += "";
            if (s.Where.equals("")) {
                s.Where = "1=1";
            }
            updateSellData();
            s.serachTabel = jtab_sellserach;
            s.indexsearch();
        }
    }//GEN-LAST:event_pCLButton1ActionPerformed

    private void jtab_sellserachMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtab_sellserachMouseClicked
        updateSellItemSearch();


    }//GEN-LAST:event_jtab_sellserachMouseClicked


    private void jbt_edit2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_edit2ActionPerformed

        EditemSearch();

    }//GEN-LAST:event_jbt_edit2ActionPerformed

    private void jbt_delete2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_delete2ActionPerformed

        updateSellItemsData();
        s.IndexID = Integer.parseInt(jtab_sellItemserach.getValue());
        deleteItem();

        updateSellItemSearch();
    }//GEN-LAST:event_jbt_delete2ActionPerformed

    private void jcom_produestMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jcom_produestMouseClicked
        updatePric();
    }//GEN-LAST:event_jcom_produestMouseClicked

    private void jsp_quantityMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jsp_quantityMouseClicked
        updatePric();
    }//GEN-LAST:event_jsp_quantityMouseClicked

    private void jcom_produestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcom_produestActionPerformed

        updatePric();
        String pid = custemItmes.comBoxGetValue(jcom_produest);
        String invid = custemItmes.comBoxGetValue(jcom_inventory);
        if (pid != null && !pid.equals("") && !pid.equals("null") && !pid.equals(jcom_produest.addvalue)) {
            ac.GUI.index.productId = pid;
            ac.GUI.index.updatePinfo(pid, invid, true);

        }


    }//GEN-LAST:event_jcom_produestActionPerformed

    private void jsp_quantityStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jsp_quantityStateChanged
        updatePric();

    }//GEN-LAST:event_jsp_quantityStateChanged

    private void jsp_priceStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jsp_priceStateChanged

    }//GEN-LAST:event_jsp_priceStateChanged

    private void jcom_clientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcom_clientActionPerformed

        String pid = custemItmes.comBoxGetValue(jcom_client);

        if (pid != null && !pid.equals("") && !pid.equals("null") && !pid.equals(jcom_produest.addvalue)) {
            ac.GUI.index.clientId = pid;
            ac.GUI.index.updateCinfo(pid, true);

        }

    }//GEN-LAST:event_jcom_clientActionPerformed

    private void jbt_cancel3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_cancel3ActionPerformed

        updateSellItemsData();
        s.setcancel(false);
    }//GEN-LAST:event_jbt_cancel3ActionPerformed

    private void jlb_orderIDMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlb_orderIDMouseClicked

        //eidtable
        String code = jlb_orderID.getText();

        if (!code.equalsIgnoreCase("0") && !code.equalsIgnoreCase("")) {

            ix.inventoryOuput("update", i.getIdByCode(code));
        }
    }//GEN-LAST:event_jlb_orderIDMouseClicked

    private void jtab_rep_namesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtab_rep_namesMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_rep_namesMouseClicked

    private void jtab_rep_namesKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtab_rep_namesKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_rep_namesKeyPressed

    private void jtab_rep_namesKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtab_rep_namesKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_rep_namesKeyReleased

    private void jtab_rep_namesKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtab_rep_namesKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_rep_namesKeyTyped

    private void jtr_rep_categoryValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jtr_rep_categoryValueChanged

        String catid =jtr_rep_category.getValue();

        if (!catid.equals("0")) {

            s.Where = "`cat_id`='" + catid + "'";
        } else {
            s.Where = "";
        }

        s.indexRepIndex();
    }//GEN-LAST:event_jtr_rep_categoryValueChanged

    private void jtr_rep_typeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jtr_rep_typeValueChanged

        jlb_repTitle.setText(jtr_rep_type.getText());
    }//GEN-LAST:event_jtr_rep_typeValueChanged

    private void jd_rep_viewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jd_rep_viewActionPerformed
        updateSellData();
        /*
        
         46	فردى
         47	حالة
         48	عملاء وموردين
         49	منتجات
        
        
         50	طباعة فاتورة
         51	الحالة حسب الوقت
         52	الحالة لعميل أو مورد
         53	الحالة لعميل خلال فترة
         54	الحالة لمنتج
         55	الحالة لمنتج خلال فترة
         */
        String rtype = jtr_rep_type.getValue();;
        String where = "";
        String cat = "";
        switch (rtype) {
            case "50":
                updateSellData();
                s.setPrint(REPORTFile, SQlFile + jtab_rep_names.getValue());
                break;

            case "52":
                cat = jtab_rep_names.getValue();

                if (cat != null && !cat.equalsIgnoreCase("0") && !cat.equalsIgnoreCase("")) {
                    where = " where   client ='" + cat + "'";
                }
                s.setPrint(STATUSREPORT, SQLMOVEALL + where);
                break;

            case "51":
                if (jd_rep_from.getDate() != null && jd_rep_to.getDate() != null) {
                    where += " where  " + ac.lib.data.dateTime.updateSerechDates("date", jd_rep_from.getDate(), jd_rep_to.getDate());
                }
                s.setPrint(STATUSREPORT, SQLMOVEALL + where);
                break;

            case "53":
                cat = jtab_rep_names.getValue();
                if (cat != null && !cat.equalsIgnoreCase("0") && !cat.equalsIgnoreCase("")) {
                    where = " where   client ='" + cat + "'";
                }

                if (jd_rep_from.getDate() != null && jd_rep_to.getDate() != null) {
                    where += " and   " + ac.lib.data.dateTime.updateSerechDates("date", jd_rep_from.getDate(), jd_rep_to.getDate());
                }
                s.setPrint(STATUSREPORT, SQLMOVEALL + where);
                break;

            case "54":

                break;
            case "55":

                break;

        }
    }//GEN-LAST:event_jd_rep_viewActionPerformed

    private void jsp_unityPricMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jsp_unityPricMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jsp_unityPricMouseClicked

    private void jsp_unityPricStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jsp_unityPricStateChanged

        String pid = custemItmes.comBoxGetValue(jcom_produest);
        double quantity = Double.parseDouble(jsp_quantity.getValue().toString());
        if (quantity > 0d) {
            ///editaFroCoby
            double value = Double.parseDouble(jsp_unityPric.getValue().toString());
            double fprice = p.checkSellpricLimit(this, value, p.getMaxSellPric(pid), p.getMinSellPric(pid));
            jsp_unityPric.setValue(new Double(fprice));

            double upric = Double.parseDouble(jsp_unityPric.getValue().toString());
            jsp_price.setValue(new Double(upric * quantity));

        }

     }//GEN-LAST:event_jsp_unityPricStateChanged

    private void jcom_quantityTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcom_quantityTypeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcom_quantityTypeActionPerformed

    private void jcom_paytypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcom_paytypeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jcom_paytypeActionPerformed

    private void pCLButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pCLButton2ActionPerformed
        s.Installment(thispid);
    }//GEN-LAST:event_pCLButton2ActionPerformed

    private void jcom_inventoryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcom_inventoryActionPerformed

        String pid = custemItmes.comBoxGetValue(jcom_produest);
        String invid = custemItmes.comBoxGetValue(jcom_inventory);
        if (pid != null && !pid.equals("") && !pid.equals("null") && !pid.equals(jcom_produest.addvalue)) {

            ac.GUI.index.updatePinfo(pid, invid, true);

        }

    }//GEN-LAST:event_jcom_inventoryActionPerformed

    private void jbt_cancel4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_cancel4ActionPerformed

        updateSellData();

        resetMe();
        s.setcancel(false);
    }//GEN-LAST:event_jbt_cancel4ActionPerformed

    private void jtab_sellItemserachMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtab_sellItemserachMouseClicked

        if (!ac.ui.utils.comBoxGetValue(jcom_searchItems).equals("")) {

            s.Where = " id='" + s.getMoveItems(jtab_sellItemserach.getValue())[1] + "'";

            updateSellData();
            s.serachTabel = jtab_sellserach;
            s.indexsearch();
        }

    }//GEN-LAST:event_jtab_sellItemserachMouseClicked

    private void jbt_edit4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_edit4ActionPerformed
        updateSellItemsData();
        s.IndexID = Integer.parseInt(jtab_sellItemserach.getValue());
        deleteItem();

        updateSellItemSearch();

    }//GEN-LAST:event_jbt_edit4ActionPerformed

    private void jtab_indexDeleteItesmMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtab_indexDeleteItesmMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteItesmMouseClicked

    private void jtab_indexDeleteItesmPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jtab_indexDeleteItesmPropertyChange
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteItesmPropertyChange

    private void jtab_indexDeleteItesmCaretPositionChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_jtab_indexDeleteItesmCaretPositionChanged

    }//GEN-LAST:event_jtab_indexDeleteItesmCaretPositionChanged

    private void jtab_indexDeleteItesmKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtab_indexDeleteItesmKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteItesmKeyPressed

    private void jtab_indexDeleteItesmKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtab_indexDeleteItesmKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteItesmKeyTyped

    private void jtab_indexDeleteItesmKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtab_indexDeleteItesmKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteItesmKeyReleased

    private void jtab_indexDeleteItesmVetoableChange(java.beans.PropertyChangeEvent evt)throws java.beans.PropertyVetoException {//GEN-FIRST:event_jtab_indexDeleteItesmVetoableChange

    }//GEN-LAST:event_jtab_indexDeleteItesmVetoableChange

    private void jbt_removeItemsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_removeItemsActionPerformed
        updateSellItemsData();
        s.setRemove(Integer.parseInt(d.IndexGetValue(s.deleteTabel)));
        s.indexdelete();
    }//GEN-LAST:event_jbt_removeItemsActionPerformed

    private void jbt_removeAllItemsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_removeAllItemsActionPerformed
        updateSellItemsData();
        s.setRemoveAll();
        s.indexdelete();
    }//GEN-LAST:event_jbt_removeAllItemsActionPerformed


    private void jbt_restoreItemsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_restoreItemsActionPerformed
        updateSellItemsData();
        String itemId = d.IndexGetValue(s.deleteTabel);

        s.setRestore(Integer.parseInt(itemId));
        myDoProssItems(itemId);
        s.indexdelete();


    }//GEN-LAST:event_jbt_restoreItemsActionPerformed

    private void jbt_restoreAllItemsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_restoreAllItemsActionPerformed
        try {
            updateSellItemsData();

            ac.lib.database.operations db = new ac.lib.database.operations();

            db.setOpenCon();

            ResultSet r = db.getDataWithOutCon(s.TabelString, "*", "rowstatus ='" + rowDeleted + "'");
            while (r.next()) {

                myDoProssItems(r.getString("id"));

            }

            db.setCloseCon();

            s.setRestoreAll();
            s.indexdelete();
        } catch (SQLException ex) {
            Logger.getLogger(pricView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jbt_restoreAllItemsActionPerformed

    private void jtab_indexDeleteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jtab_indexDeleteMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteMouseClicked

    private void jtab_indexDeletePropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jtab_indexDeletePropertyChange
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeletePropertyChange

    private void jtab_indexDeleteCaretPositionChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_jtab_indexDeleteCaretPositionChanged
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteCaretPositionChanged

    private void jtab_indexDeleteKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtab_indexDeleteKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteKeyPressed

    private void jtab_indexDeleteKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtab_indexDeleteKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteKeyTyped

    private void jtab_indexDeleteKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jtab_indexDeleteKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteKeyReleased

    private void jtab_indexDeleteVetoableChange(java.beans.PropertyChangeEvent evt)throws java.beans.PropertyVetoException {//GEN-FIRST:event_jtab_indexDeleteVetoableChange
        // TODO add your handling code here:
    }//GEN-LAST:event_jtab_indexDeleteVetoableChange

    private void jbt_removeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_removeActionPerformed
        updateSellData();
        s.setRemove(Integer.parseInt(d.IndexGetValue(s.deleteTabel)));
        s.indexdelete();
    }//GEN-LAST:event_jbt_removeActionPerformed

    private void jbt_removeAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_removeAllActionPerformed
        updateSellData();
        s.setRemoveAll();
        s.indexdelete();
    }//GEN-LAST:event_jbt_removeAllActionPerformed


    private void jbt_restoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_restoreActionPerformed
        updateSellData();

        s.setRestore(Integer.parseInt(d.IndexGetValue(s.deleteTabel)));
        myDoPross(d.IndexGetValue(s.deleteTabel));

        s.indexdelete();

    }//GEN-LAST:event_jbt_restoreActionPerformed

    private void jbt_restoreAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_restoreAllActionPerformed
        try {
            updateSellData();

            ac.lib.database.operations db = new ac.lib.database.operations();

            db.setOpenCon();

            ResultSet r = db.getDataWithOutCon(s.TabelString, "*", "rowstatus ='" + rowDeleted + "'");
            while (r.next()) {

                myDoPross(r.getString("id"));

            }

            db.setCloseCon();

            s.setRestoreAll();
            s.indexdelete();
        } catch (SQLException ex) {
            Logger.getLogger(pricView.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jbt_restoreAllActionPerformed

    private void jlb_billIDMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jlb_billIDMouseClicked
        ///editabelForCoby
        String code = jlb_billID.getText();

        if (!code.equalsIgnoreCase("0") && !code.equalsIgnoreCase("")) {
            ac.engin.moves.sell s = new ac.engin.moves.sell();

            ix.sellMoveOpen("update", s.getIdByCode(code));
        }
    }//GEN-LAST:event_jlb_billIDMouseClicked

    private void jbt_add7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbt_add7ActionPerformed

        s.creatBill(thispid, this);
    }//GEN-LAST:event_jbt_add7ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane13;
    private javax.swing.JScrollPane jScrollPane14;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private ac.ui.controls.PCLTextarea ja_more;
    private ac.ui.controls.PCLTextarea ja_sn;
    private ac.ui.controls.PCLButton jbt_add;
    private ac.ui.controls.PCLButton jbt_add3;
    private ac.ui.controls.PCLButton jbt_add4;
    private ac.ui.controls.PCLButton jbt_add6;
    private ac.ui.controls.PCLButton jbt_add7;
    private ac.ui.controls.PCLButton jbt_cancel3;
    private ac.ui.controls.PCLButton jbt_cancel4;
    private ac.ui.controls.PCLButton jbt_delete1;
    private ac.ui.controls.PCLButton jbt_delete2;
    private ac.ui.controls.PCLButton jbt_delete3;
    private ac.ui.controls.PCLButton jbt_edit1;
    private ac.ui.controls.PCLButton jbt_edit2;
    private ac.ui.controls.PCLButton jbt_edit3;
    private ac.ui.controls.PCLButton jbt_edit4;
    private ac.ui.controls.PCLButton jbt_print;
    private ac.ui.controls.PCLButton jbt_print1;
    private ac.ui.controls.PCLButton jbt_remove;
    private ac.ui.controls.PCLButton jbt_removeAll;
    private ac.ui.controls.PCLButton jbt_removeAllItems;
    private ac.ui.controls.PCLButton jbt_removeItems;
    private ac.ui.controls.PCLButton jbt_restore;
    private ac.ui.controls.PCLButton jbt_restoreAll;
    private ac.ui.controls.PCLButton jbt_restoreAllItems;
    private ac.ui.controls.PCLButton jbt_restoreItems;
    private ac.ui.controls.PCLGetdata jcom_client;
    private ac.ui.controls.PCLGetdataFull jcom_inventory;
    private ac.ui.controls.PCLcomboboxAdd jcom_paytype;
    private ac.ui.controls.PCLGetdata jcom_produest;
    private ac.ui.controls.PCLcomboboxAdd jcom_quantityType;
    private ac.ui.controls.PCLcomboBox jcom_search;
    private ac.ui.controls.PCLcomboBox jcom_searchItems;
    private ac.ui.controls.PCLDate jd_To;
    private org.jdesktop.swingx.JXDatePicker jd_date;
    private ac.ui.controls.PCLDate jd_from;
    private ac.ui.controls.PCLDate jd_rep_from;
    private ac.ui.controls.PCLDate jd_rep_to;
    private ac.ui.controls.PCLButton jd_rep_view;
    private ac.ui.controls.PCLLabel jlb_allPric;
    private ac.ui.controls.PCLLabel jlb_allPric1;
    private ac.ui.controls.PCLLabel jlb_allPric2;
    private ac.ui.controls.PCLLabel jlb_allPricText;
    private ac.ui.controls.PCLLabel jlb_allPricText1;
    private javax.swing.JLabel jlb_billID;
    private ac.ui.controls.PCLLabel jlb_orderID;
    private ac.ui.controls.PCLLabel jlb_repTitle;
    private ac.ui.controls.PCLLabel jlb_status;
    private ac.ui.controls.PCLPanel jp_retportNames;
    private ac.ui.controls.PCLPanel jp_retportTaype;
    private ac.ui.controls.PCLPanel jp_retportcon;
    private ac.ui.controls.PCLSpinner jsp_price;
    private ac.ui.controls.PCLSpinner jsp_quantity;
    private ac.ui.controls.PCLSpinner jsp_unityPric;
    private ac.ui.controls.PCLTabs jtab_data;
    private ac.ui.controls.PCLTable jtab_index;
    private ac.ui.controls.PCLTable jtab_indexDelete;
    private ac.ui.controls.PCLTable jtab_indexDeleteItesm;
    private ac.ui.controls.PCLTable jtab_rep_names;
    private ac.ui.controls.PCLTable jtab_sellItemserach;
    private ac.ui.controls.PCLTable jtab_sellserach;
    private ac.ui.controls.PCLTree jtr_rep_category;
    private ac.ui.controls.PCLTree jtr_rep_type;
    private ac.ui.controls.PCLCode jtxt_code;
    private ac.ui.controls.PCLTextField jtxt_search;
    private ac.ui.controls.PCLButton pCLButton1;
    private ac.ui.controls.PCLButton pCLButton2;
    private ac.ui.controls.PCLLabel pCLLabel1;
    private ac.ui.controls.PCLLabel pCLLabel11;
    private ac.ui.controls.PCLLabel pCLLabel12;
    private ac.ui.controls.PCLLabel pCLLabel13;
    private ac.ui.controls.PCLLabel pCLLabel14;
    private ac.ui.controls.PCLLabel pCLLabel15;
    private ac.ui.controls.PCLLabel pCLLabel16;
    private ac.ui.controls.PCLLabel pCLLabel17;
    private ac.ui.controls.PCLLabel pCLLabel18;
    private ac.ui.controls.PCLLabel pCLLabel19;
    private ac.ui.controls.PCLLabel pCLLabel2;
    private ac.ui.controls.PCLLabel pCLLabel20;
    private ac.ui.controls.PCLLabel pCLLabel21;
    private ac.ui.controls.PCLLabel pCLLabel22;
    private ac.ui.controls.PCLLabel pCLLabel23;
    private ac.ui.controls.PCLLabel pCLLabel24;
    private ac.ui.controls.PCLLabel pCLLabel25;
    private ac.ui.controls.PCLLabel pCLLabel26;
    private ac.ui.controls.PCLLabel pCLLabel4;
    private ac.ui.controls.PCLPanel pCLPanel1;
    private ac.ui.controls.PCLPanel pCLPanel2;
    private ac.ui.controls.PCLPanel pCLPanel3;
    private ac.ui.controls.PCLPanel pCLPanel4;
    private ac.ui.controls.PCLPanel pCLPanel5;
    private ac.ui.controls.PCLTextarea pCLTextarea1;
    private ac.ui.controls.PCLToolbar pCLToolbar10;
    private ac.ui.controls.PCLToolbar pCLToolbar11;
    private ac.ui.controls.PCLToolbar pCLToolbar5;
    private ac.ui.controls.PCLToolbar pCLToolbar6;
    private ac.ui.controls.PCLToolbar pCLToolbar7;
    private ac.ui.controls.PCLToolbar pCLToolbar8;
    private ac.ui.controls.PCLToolbar pCLToolbar9;
    private ac.ui.controls.PCLPanel sell_panel;
    private ac.ui.controls.PCLPanel sellitemPanel;
    // End of variables declaration//GEN-END:variables
}
